﻿using MediatR;
using RBAC.LuFang.API.Application.Command.imgCommand;
using RBAC.LuFang.Domain.Traceability;
using RBAC.LuFang.Domin.Services.TraceabilityService;

namespace RBAC.LuFang.API.Application.CommandHandlers.imgCommandHandler
{
    public class imgAddChanPinCommandHandler:IRequestHandler<imgAddChanPinCommand,int>
    {
        private readonly IGoodsService _goodsService;

        public imgAddChanPinCommandHandler(IGoodsService goodsService)
        {
            _goodsService = goodsService;
        }

        public async Task<int> Handle(imgAddChanPinCommand request, CancellationToken cancellationToken)
        {
           var imgmodel=new imges() { imgesimg = request.imgesimg,imgestype=request.imgestype ,goodsId=request.goodsId};
            return await _goodsService.AddPic(imgmodel);
        }
    }
}
